package com.xc.hotelmgr.webapi.modules.op.controller;

import java.util.Arrays;
import java.util.Map;

import com.xc.hotelmgr.webapi.common.annotation.SysLog;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.xc.hotelmgr.webapi.modules.op.entity.TaskDetailEntity;
import com.xc.hotelmgr.webapi.modules.op.service.TaskDetailService;
import com.xc.hotelmgr.webapi.common.utils.PageUtils;
import com.xc.hotelmgr.webapi.common.utils.R;



/**
 * 任务执行异常酒店列表
 *
 * @author kemmy
 * @email kemmy@gmail.com
 * @date 2020-10-20 13:02:19
 */
@RestController
@RequestMapping("op/taskdetail")
public class TaskDetailController {
    @Autowired
    private TaskDetailService taskDetailService;

    /**
     * 列表
     */
    @SysLog
    @RequestMapping("/list")
    @RequiresPermissions("op:taskdetail:list")
    public R list(@RequestParam Map<String, Object> params){
//        PageUtils page = taskDetailService.queryPage(params);
        PageUtils page = taskDetailService.sqlQueryPage(params);
        return R.ok().put("page", page);
    }

    /**
     * 保存
     */
    @SysLog
    @RequestMapping("/pull")
    @RequiresPermissions("op:taskdetail:save")
    public R save(@RequestBody TaskDetailEntity taskDetail){
		taskDetailService.save(taskDetail);

        return R.ok();
    }


    /**
     * 删除
     */
    @SysLog
    @RequestMapping("/delete")
    @RequiresPermissions("op:taskdetail:delete")
    public R delete(@RequestBody Long[] ids){
		taskDetailService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
